home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 January: Mac OS SDK / Dev.CD Jan 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / CIncludes / QD3DViewer.h < prev    next >
Encoding:
C/C++ Source or Header  |  1998-08-17  |  13.9 KB  |  462 lines  |  [TEXT/MPS ]

  1. /*
  2.      File:        QD3DViewer.h
  3.  
  4.      Contains:    MacOS Viewer Controller Interface File.                                
  5.  
  6.      Version:    Technology:    Quickdraw 3D 1.5.4
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1995-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __QD3DVIEWER__
  18. #define __QD3DVIEWER__
  19.  
  20. #ifndef __QD3D__
  21. #include <QD3D.h>
  22. #endif
  23. #ifndef __QD3DGROUP__
  24. #include <QD3DGroup.h>
  25. #endif
  26.  
  27. #if TARGET_OS_MAC
  28. #ifndef __EVENTS__
  29. #include <Events.h>
  30. #endif
  31. #ifndef __MACTYPES__
  32. #include <MacTypes.h>
  33. #endif
  34. #ifndef __QUICKDRAW__
  35. #include <Quickdraw.h>
  36. #endif
  37. #endif  /* TARGET_OS_MAC */
  38.  
  39.  
  40.  
  41. #if PRAGMA_ONCE
  42. #pragma once
  43. #endif
  44.  
  45. #ifdef __cplusplus
  46. extern "C" {
  47. #endif
  48.  
  49. #if PRAGMA_IMPORT
  50. #pragma import on
  51. #endif
  52.  
  53. #if PRAGMA_STRUCT_ALIGN
  54.     #pragma options align=power
  55. #elif PRAGMA_STRUCT_PACKPUSH
  56.     #pragma pack(push, 2)
  57. #elif PRAGMA_STRUCT_PACK
  58.     #pragma pack(2)
  59. #endif
  60.  
  61. #if PRAGMA_ENUM_ALWAYSINT
  62.     #pragma enumsalwaysint on
  63. #elif PRAGMA_ENUM_OPTIONS
  64.     #pragma option enum=int
  65. #elif PRAGMA_ENUM_PACK
  66.     #if __option(pack_enums)
  67.         #define PRAGMA_ENUM_PACK__QD3DVIEWER__
  68.     #endif
  69.     #pragma options(!pack_enums)
  70. #endif
  71.  
  72. #if TARGET_OS_MAC
  73. typedef void *                            TQ3ViewerObject;
  74. typedef CALLBACK_API_C( OSErr , TQ3ViewerDrawingCallbackMethod )(TQ3ViewerObject theViewer, const void *data);
  75.  
  76. enum {
  77.     kQ3ViewerShowBadge            = 1 << 0,
  78.     kQ3ViewerActive                = 1 << 1,
  79.     kQ3ViewerControllerVisible    = 1 << 2,
  80.     kQ3ViewerDrawFrame            = 1 << 3,
  81.     kQ3ViewerDraggingOff        = 1 << 4,
  82.     kQ3ViewerButtonCamera        = 1 << 5,
  83.     kQ3ViewerButtonTruck        = 1 << 6,
  84.     kQ3ViewerButtonOrbit        = 1 << 7,
  85.     kQ3ViewerButtonZoom            = 1 << 8,
  86.     kQ3ViewerButtonDolly        = 1 << 9,
  87.     kQ3ViewerButtonReset        = 1 << 10,
  88.     kQ3ViewerOutputTextMode        = 1 << 11,
  89.     kQ3ViewerDragMode            = 1 << 12,
  90.     kQ3ViewerDrawGrowBox        = 1 << 13,
  91.     kQ3ViewerDrawDragBorder        = 1 << 14,
  92.     kQ3ViewerDraggingInOff        = 1 << 15,
  93.     kQ3ViewerDraggingOutOff        = 1 << 16,
  94.     kQ3ViewerDefault            = 1 << 31
  95. };
  96.  
  97.  
  98. enum {
  99.     kQ3ViewerEmpty                = 0,
  100.     kQ3ViewerHasModel            = 1 << 0,
  101.     kQ3ViewerHasUndo            = 1 << 1
  102. };
  103.  
  104.  
  105. enum TQ3ViewerCameraView {
  106.     kQ3ViewerCameraRestore        = 0,
  107.     kQ3ViewerCameraFit            = 1,
  108.     kQ3ViewerCameraFront        = 2,
  109.     kQ3ViewerCameraBack            = 3,
  110.     kQ3ViewerCameraLeft            = 4,
  111.     kQ3ViewerCameraRight        = 5,
  112.     kQ3ViewerCameraTop            = 6,
  113.     kQ3ViewerCameraBottom        = 7
  114. };
  115. typedef enum TQ3ViewerCameraView TQ3ViewerCameraView;
  116.  
  117.  
  118. /******************************************************************************
  119.  **                                                                             **
  120.  **        Return viewer version number                                         **
  121.  **                                                                             **
  122.  *****************************************************************************/
  123. EXTERN_API_C( OSErr )
  124. Q3ViewerGetVersion                (unsigned long *        majorRevision,
  125.                                  unsigned long *        minorRevision);
  126.  
  127.  
  128.  
  129. /******************************************************************************
  130.  **                                                                             **
  131.  **        Return viewer release version number                                 **
  132.  **        (in 'vers' format - e.g. 0x01518000 ==> 1.5.1 release)                 **
  133.  **                                                                             **
  134.  *****************************************************************************/
  135. EXTERN_API_C( OSErr )
  136. Q3ViewerGetReleaseVersion        (unsigned long *        releaseRevision);
  137.  
  138.  
  139. /******************************************************************************
  140.  **                                                                             **
  141.  **                        Creation and destruction                             **
  142.  **                Note that this is not a QuickDraw 3D object                     **
  143.  **                                                                             **
  144.  *****************************************************************************/
  145. EXTERN_API_C( TQ3ViewerObject )
  146. Q3ViewerNew                        (CGrafPtr                 port,
  147.                                  Rect *                    rect,
  148.                                  unsigned long             flags);
  149.  
  150. EXTERN_API_C( OSErr )
  151. Q3ViewerDispose                    (TQ3ViewerObject         theViewer);
  152.  
  153. /******************************************************************************
  154.  **                                                                             **
  155.  **                    Functions to attach data to a viewer                     **
  156.  **                                                                             **
  157.  *****************************************************************************/
  158. EXTERN_API_C( OSErr )
  159. Q3ViewerUseFile                    (TQ3ViewerObject         theViewer,
  160.                                  long                     refNum);
  161.  
  162. EXTERN_API_C( OSErr )
  163. Q3ViewerUseData                    (TQ3ViewerObject         theViewer,
  164.                                  void *                    data,
  165.                                  long                     size);
  166.  
  167. /******************************************************************************
  168.  **                                                                             **
  169.  **        Functions to write data out from the Viewer                             **
  170.  **                                                                             **
  171.  *****************************************************************************/
  172. EXTERN_API_C( OSErr )
  173. Q3ViewerWriteFile                (TQ3ViewerObject         theViewer,
  174.                                  long                     refNum);
  175.  
  176. EXTERN_API_C( unsigned long )
  177. Q3ViewerWriteData                (TQ3ViewerObject         theViewer,
  178.                                  Handle                 data);
  179.  
  180. /******************************************************************************
  181.  **                                                                             **
  182.  **        Use this function to force the Viewer to re-draw                     **
  183.  **                                                                             **
  184.  *****************************************************************************/
  185. EXTERN_API_C( OSErr )
  186. Q3ViewerDraw                    (TQ3ViewerObject         theViewer);
  187.  
  188. EXTERN_API_C( OSErr )
  189. Q3ViewerDrawContent                (TQ3ViewerObject         theViewer);
  190.  
  191. EXTERN_API_C( OSErr )
  192. Q3ViewerDrawControlStrip        (TQ3ViewerObject         theViewer);
  193.  
  194. /******************************************************************************
  195.  **                                                                             **
  196.  **        Function used by the Viewer to filter and handle events                 **
  197.  **                                                                             **
  198.  *****************************************************************************/
  199. EXTERN_API_C( Boolean )
  200. Q3ViewerEvent                    (TQ3ViewerObject         theViewer,
  201.                                  EventRecord *            evt);
  202.  
  203. /******************************************************************************
  204.  **                                                                             **
  205.  **        This function returns a PICT of the contents of the                  **
  206.  **        Viewer's window.  The application should dispose the PICT.             **
  207.  **                                                                             **
  208.  *****************************************************************************/
  209. EXTERN_API_C( PicHandle )
  210. Q3ViewerGetPict                    (TQ3ViewerObject         theViewer);
  211.  
  212. /******************************************************************************
  213.  **                                                                             **
  214.  **                        Calls for dealing with Buttons                         **
  215.  **                                                                             **
  216.  *****************************************************************************/
  217. EXTERN_API_C( OSErr )
  218. Q3ViewerGetButtonRect            (TQ3ViewerObject         theViewer,
  219.                                  unsigned long             button,
  220.                                  Rect *                    rect);
  221.  
  222. EXTERN_API_C( unsigned long )
  223. Q3ViewerGetCurrentButton        (TQ3ViewerObject         theViewer);
  224.  
  225. EXTERN_API_C( OSErr )
  226. Q3ViewerSetCurrentButton        (TQ3ViewerObject         theViewer,
  227.                                  unsigned long             button);
  228.  
  229. /******************************************************************************
  230.  **                                                                             **
  231.  **        Functions to set/get the group to be displayed by the Viewer.         **
  232.  **                                                                             **
  233.  *****************************************************************************/
  234. EXTERN_API_C( OSErr )
  235. Q3ViewerUseGroup                (TQ3ViewerObject         theViewer,
  236.                                  TQ3GroupObject         group);
  237.  
  238. EXTERN_API_C( TQ3GroupObject )
  239. Q3ViewerGetGroup                (TQ3ViewerObject         theViewer);
  240.  
  241. /******************************************************************************
  242.  **                                                                             **
  243.  **        Functions to set/get the color used to clear the window                 **
  244.  **                                                                             **
  245.  *****************************************************************************/
  246. EXTERN_API_C( OSErr )
  247. Q3ViewerSetBackgroundColor        (TQ3ViewerObject         theViewer,
  248.                                  TQ3ColorARGB *            color);
  249.  
  250. EXTERN_API_C( OSErr )
  251. Q3ViewerGetBackgroundColor        (TQ3ViewerObject         theViewer,
  252.                                  TQ3ColorARGB *            color);
  253.  
  254. /******************************************************************************
  255.  **                                                                             **
  256.  **        Getting/Setting a Viewer's View object.  Disposal is needed.         **
  257.  **                                                                             **
  258.  *****************************************************************************/
  259. EXTERN_API_C( TQ3ViewObject )
  260. Q3ViewerGetView                    (TQ3ViewerObject         theViewer);
  261.  
  262. EXTERN_API_C( OSErr )
  263. Q3ViewerRestoreView                (TQ3ViewerObject         theViewer);
  264.  
  265. /******************************************************************************
  266.  **                                                                             **
  267.  **        Calls for setting/getting viewer flags                                 **
  268.  **                                                                             **
  269.  *****************************************************************************/
  270. EXTERN_API_C( OSErr )
  271. Q3ViewerSetFlags                (TQ3ViewerObject         theViewer,
  272.                                  unsigned long             flags);
  273.  
  274. EXTERN_API_C( unsigned long )
  275. Q3ViewerGetFlags                (TQ3ViewerObject         theViewer);
  276.  
  277. /******************************************************************************
  278.  **                                                                             **
  279.  **        Calls related to bounds/dimensions.  Bounds is the size of              **
  280.  **        the window.  Dimensions can either be the Rect from the ViewHints     **
  281.  **        or the current dimensions of the window (if you do a Set).             **
  282.  **                                                                             **
  283.  *****************************************************************************/
  284. EXTERN_API_C( OSErr )
  285. Q3ViewerSetBounds                (TQ3ViewerObject         theViewer,
  286.                                  Rect *                    bounds);
  287.  
  288. EXTERN_API_C( OSErr )
  289. Q3ViewerGetBounds                (TQ3ViewerObject         theViewer,
  290.                                  Rect *                    bounds);
  291.  
  292. EXTERN_API_C( OSErr )
  293. Q3ViewerSetDimension            (TQ3ViewerObject         theViewer,
  294.                                  unsigned long             width,
  295.                                  unsigned long             height);
  296.  
  297. EXTERN_API_C( OSErr )
  298. Q3ViewerGetDimension            (TQ3ViewerObject         theViewer,
  299.                                  unsigned long *        width,
  300.                                  unsigned long *        height);
  301.  
  302. EXTERN_API_C( OSErr )
  303. Q3ViewerGetMinimumDimension        (TQ3ViewerObject         theViewer,
  304.                                  unsigned long *        width,
  305.                                  unsigned long *        height);
  306.  
  307. /******************************************************************************
  308.  **                                                                             **
  309.  **                            Port related calls                                 **
  310.  **                                                                             **
  311.  *****************************************************************************/
  312. EXTERN_API_C( OSErr )
  313. Q3ViewerSetPort                    (TQ3ViewerObject         theViewer,
  314.                                  CGrafPtr                 port);
  315.  
  316. EXTERN_API_C( CGrafPtr )
  317. Q3ViewerGetPort                    (TQ3ViewerObject         theViewer);
  318.  
  319. /******************************************************************************
  320.  **                                                                             **
  321.  **        Adjust Cursor should be called from idle loop to allow the Viewer     **
  322.  **        to change the cursor according to the cursor position/object under     **
  323.  **        the cursor.                                                             **
  324.  **                                                                             **
  325.  *****************************************************************************/
  326. EXTERN_API_C( Boolean )
  327. Q3ViewerAdjustCursor            (TQ3ViewerObject         theViewer,
  328.                                  Point *                pt);
  329.  
  330. EXTERN_API_C( OSErr )
  331. Q3ViewerCursorChanged            (TQ3ViewerObject         theViewer);
  332.  
  333.  
  334. /******************************************************************************
  335.  **                                                                             **
  336.  **        Returns the state of the viewer.  See the constant defined at the     **
  337.  **        top of this file.                                                     **
  338.  **                                                                             **
  339.  *****************************************************************************/
  340. EXTERN_API_C( unsigned long )
  341. Q3ViewerGetState                (TQ3ViewerObject         theViewer);
  342.  
  343. /******************************************************************************
  344.  **                                                                             **
  345.  **                            Clipboard utilities                                 **
  346.  **                                                                             **
  347.  *****************************************************************************/
  348. EXTERN_API_C( OSErr )
  349. Q3ViewerClear                    (TQ3ViewerObject         theViewer);
  350.  
  351. EXTERN_API_C( OSErr )
  352. Q3ViewerCut                        (TQ3ViewerObject         theViewer);
  353.  
  354. EXTERN_API_C( OSErr )
  355. Q3ViewerCopy                    (TQ3ViewerObject         theViewer);
  356.  
  357. EXTERN_API_C( OSErr )
  358. Q3ViewerPaste                    (TQ3ViewerObject         theViewer);
  359.  
  360.  
  361. /******************************************************************************
  362.  **                                                                             **
  363.  **                            New Event Model                                     **
  364.  **                                                                             **
  365.  *****************************************************************************/
  366. EXTERN_API_C( Boolean )
  367. Q3ViewerMouseDown                (TQ3ViewerObject         theViewer,
  368.                                  long                     x,
  369.                                  long                     y);
  370.  
  371. EXTERN_API_C( Boolean )
  372. Q3ViewerContinueTracking        (TQ3ViewerObject         theViewer,
  373.                                  long                     x,
  374.                                  long                     y);
  375.  
  376. EXTERN_API_C( Boolean )
  377. Q3ViewerMouseUp                    (TQ3ViewerObject         theViewer,
  378.                                  long                     x,
  379.                                  long                     y);
  380.  
  381. EXTERN_API_C( Boolean )
  382. Q3ViewerHandleKeyEvent            (TQ3ViewerObject         theViewer,
  383.                                  EventRecord *            evt);
  384.  
  385.  
  386. /******************************************************************************
  387.  **                                                                             **
  388.  **                                Drawing CallBack                             **
  389.  **                                                                             **
  390.  *****************************************************************************/
  391. EXTERN_API_C( OSErr )
  392. Q3ViewerSetDrawingCallbackMethod (TQ3ViewerObject         theViewer,
  393.                                  TQ3ViewerDrawingCallbackMethod  callbackMethod,
  394.                                  const void *            data);
  395.  
  396.  
  397. /******************************************************************************
  398.  **                                                                             **
  399.  **                                    Undo                                     **
  400.  **                                                                             **
  401.  *****************************************************************************/
  402. EXTERN_API_C( OSErr )
  403. Q3ViewerUndo                    (TQ3ViewerObject         theViewer);
  404.  
  405. EXTERN_API_C( Boolean )
  406. Q3ViewerGetUndoString            (TQ3ViewerObject         theViewer,
  407.                                  char *                    str,
  408.                                  unsigned long *        cnt);
  409.  
  410.  
  411. /******************************************************************************
  412.  **                                                                             **
  413.  **                                Camera Support                                 **
  414.  **                                                                             **
  415.  *****************************************************************************/
  416. EXTERN_API_C( OSErr )
  417. Q3ViewerGetCameraCount            (TQ3ViewerObject         theViewer,
  418.                                  unsigned long *        cnt);
  419.  
  420. EXTERN_API_C( OSErr )
  421. Q3ViewerSetCameraByNumber        (TQ3ViewerObject         theViewer,
  422.                                  unsigned long             cameraNo);
  423.  
  424. EXTERN_API_C( OSErr )
  425. Q3ViewerSetCameraByView            (TQ3ViewerObject         theViewer,
  426.                                  TQ3ViewerCameraView     viewType);
  427.  
  428. #endif  /* TARGET_OS_MAC */
  429.  
  430.  
  431.  
  432.  
  433.  
  434. #if PRAGMA_ENUM_ALWAYSINT
  435.     #pragma enumsalwaysint reset
  436. #elif PRAGMA_ENUM_OPTIONS
  437.     #pragma option enum=reset
  438. #elif defined(PRAGMA_ENUM_PACK__QD3DVIEWER__)
  439.     #pragma options(pack_enums)
  440. #endif
  441.  
  442. #if PRAGMA_STRUCT_ALIGN
  443.     #pragma options align=reset
  444. #elif PRAGMA_STRUCT_PACKPUSH
  445.     #pragma pack(pop)
  446. #elif PRAGMA_STRUCT_PACK
  447.     #pragma pack()
  448. #endif
  449.  
  450. #ifdef PRAGMA_IMPORT_OFF
  451. #pragma import off
  452. #elif PRAGMA_IMPORT
  453. #pragma import reset
  454. #endif
  455.  
  456. #ifdef __cplusplus
  457. }
  458. #endif
  459.  
  460. #endif /* __QD3DVIEWER__ */
  461.  
  462.